package net.lijingye.education.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "user")
public class User implements Serializable {
    @Id
    @Column(name = "userId")
    private String id;
    @Column(name = "username")
    private String name;
    @Column(name = "nickname")
    private String nickName;
    @Column(name = "psd")
    private String password;
    @Column(name = "gender")
    private int gender;
    @Column(name = "faceIcon")
    private String faceIcon;
    @Column(name = "birthday")
    private Date birthday;
    @Column(name = "telephone")
    private String telephone;
    @Column(name = "hobbies")
    private String hobbies;
    @Column(name = "motto")
    private String motto;
    @Column(name = "email")
    private String email;
    @OneToOne
    @JoinColumn(name = "departId")
    private Depart depart;
    @OneToOne
    @JoinColumn(name = "homelandP")
    private Province province;
    @OneToOne
    @JoinColumn(name = "homelandC")
    private City city;
    @OneToMany
    @JoinColumn(name = "userId")
    @OrderBy(value = "time desc")
    private List<Visitor> visitorList;
    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name = "userId")
    private List<Friend> friendList;
    @OneToMany
    @JoinColumn(name = "targetId")
    private List<FriendRequest> friendRequestList;
    @OneToMany
    @JoinColumn(name = "userId")
    private List<Tweet> tweetList;
    @ManyToMany
    @JoinTable(name = "student_class", joinColumns = {@JoinColumn(name = "userId")}, inverseJoinColumns = {@JoinColumn(name = "classId")})
    private List<Lesson> lessonList;

    public User() {
    }

    public User(String id, String name, String nickName, String password, int gender, String faceIcon, Date birthday, String telephone, String hobbies, String motto, String email, Depart depart, Province province, City city, List<Visitor> visitorList, List<Friend> friendList, List<FriendRequest> friendRequestList, List<Lesson> lessonList) {
        this.id = id;
        this.name = name;
        this.nickName = nickName;
        this.password = password;
        this.gender = gender;
        this.faceIcon = faceIcon;
        this.birthday = birthday;
        this.telephone = telephone;
        this.hobbies = hobbies;
        this.motto = motto;
        this.email = email;
        this.depart = depart;
        this.province = province;
        this.city = city;
        this.visitorList = visitorList;
        this.friendList = friendList;
        this.friendRequestList = friendRequestList;
        this.lessonList = lessonList;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    public String getFaceIcon() {
        return faceIcon;
    }

    public void setFaceIcon(String faceIcon) {
        this.faceIcon = faceIcon;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getHobbies() {
        return hobbies;
    }

    public void setHobbies(String hobbies) {
        this.hobbies = hobbies;
    }

    public String getMotto() {
        return motto;
    }

    public void setMotto(String motto) {
        this.motto = motto;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Depart getDepart() {
        return depart;
    }

    public void setDepart(Depart depart) {
        this.depart = depart;
    }

    public Province getProvince() {
        return province;
    }

    public void setProvince(Province province) {
        this.province = province;
    }

    public City getCity() {
        return city;
    }

    public void setCity(City city) {
        this.city = city;
    }

    public List<Visitor> getVisitorList() {
        return visitorList;
    }

    public void setVisitorList(List<Visitor> visitorList) {
        this.visitorList = visitorList;
    }

    public List<Friend> getFriendList() {
        return friendList;
    }

    public void setFriendList(List<Friend> friendList) {
        this.friendList = friendList;
    }

    public List<FriendRequest> getFriendRequestList() {
        return friendRequestList;
    }

    public void setFriendRequestList(List<FriendRequest> friendRequestList) {
        this.friendRequestList = friendRequestList;
    }

    public List<Tweet> getTweetList() {
        return tweetList;
    }

    public void setTweetList(List<Tweet> tweetList) {
        this.tweetList = tweetList;
    }

    public List<Lesson> getLessonList() {
        return lessonList;
    }

    public void setLessonList(List<Lesson> lessonList) {
        this.lessonList = lessonList;
    }
}